const ssoLogin = ({ res, response }) => {
  res.setHeader("Content-Type", "application/json");
  try {
    response = response.match(/ssoLogin_JSONPMethod\((.*?)\)/)[1];

    return JSON.stringify({
      data: JSON.parse(response).data,
      success: true,
    });
  } catch (error) {
    return JSON.stringify({
      success: false,
    });
  }
};

module.exports = {
  ssoLogin,
};
